<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type')->comment('类型 201 公司新闻 news 202 公司公告 notice 203 活动预告 activity 204 招商引资 attract 205 文化娱乐 culture 206 咨询中心 consultation 207 服务中心 service 208 投资新闻 investment 209 投资政策 policy')->index();
            $table->string('title')->comment('标题')->index();
            $table->string('cover')->comment('封面图');
            $table->text('body')->comment('内容');
            $table->json('other_infos')->nullable()->comment('其他信息');
            $table->unsignedInteger('number')->default(0)->comment('显示顺序')->index();
            $table->boolean('is_show')->default(0)->comment('是否显示');
            $table->boolean('is_show_index')->default(0)->comment('是否显示在首页');
            $table->unsignedInteger('views')->default(0)->comment('浏览量')->index();
            $table->unsignedInteger('fake_views')->default(0)->comment('假浏览量')->index();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
